<template>
  <svg :class="svgClass" aria-hidden="true" v-on="listeners">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script>
import { Options, Vue } from 'vue-class-component';
Options({
  name: 'SvgIcon',
  props: {
    iconClass: {
      type: String,
      required: true
    },
    className: {
      type: String,
      default: ''
    }
  },
  computed: {
    iconName () {
      return `#icon-${this.iconClass}`
    },
    listeners () {
      return {
        ...this.$listeners
      }
    }
  },
  svgClass () {
    if (this.className) {
      return 'svg-icon' + this.className
    } else {
      return 'svg-icon'
    }
  }
})
export default class SvgIcon extends Vue {
}
</script>
